
#include "Face.h"
#include "Vertex.h"

/************************************************/
/*				Members 						*/
/************************************************/

void Face::ComputeNormal()
{
    /*  float4 vertexA = & m_Vertices.at(0);
        float4 vertexB = & m_Vertices.at(1);
    */
   // m_Normal = float4.Cross(vertexA, vertexB);
}

/************************************************/
/*				Statics 						*/
/************************************************/

    /************************************************/
    /*				Properties 						*/
    /************************************************/

        std::vector<Face *> 		Face::Faces;

    /************************************************/
    /*				Methods 						*/
    /************************************************/

        Face * Face::New(Vertex * a, Vertex * b, Vertex * c)
        {
            Face * face = new Face(a,  b,  c);
            Faces.push_back(face);
            return face;
        }
		
        unsigned short * Face::Array()
        {
            std::vector<unsigned short> index;
			int f=0;
            int g=0;
			
            for(int i=0;i< Faces.size(); i++)
            {
                g=f;
                for(int j=0; j<Faces[i]->m_Vertices.size(); j++)
                {
					f++;
				
                    Faces[i]->m_Offset=g;
					
                    index.push_back(Faces[i]->m_Vertices[j]->m_Index);
                }

            }

            unsigned short * a_Index = new unsigned short[index.size()];
            for(int i=0;i<index.size();i++)
            {
                a_Index[i]=index[i];
            }

            return a_Index;

        }

/************************************************/
/*				Constructors					*/
/************************************************/

Face::Face(Vertex *a, Vertex *b, Vertex *c)
{
    m_Vertices.push_back(a); m_Vertices.push_back(b);m_Vertices.push_back(c);
}

